package com.hxd.mall.utils.net;

import android.util.Log;

import com.hxd.mall.utils.open.GsonUtil;

import java.io.IOException;

import okhttp3.Call;
import okhttp3.OkHttpClient;
import okhttp3.Request;

public class SimpleNet {

    public  static <T> void get(String url, final CallBack callBack){

        OkHttpClient client=new OkHttpClient();
        Request request=new Request
                .Builder()
                .url(url)
                .build();
        Call call=client.newCall(request);
        call.enqueue(new okhttp3.Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
                callBack.faile();
            }

            @Override
            public void onResponse(Call call, okhttp3.Response response) throws IOException {
                callBack.success(response.body().string());
            }
        });
    }

    interface CallBack<T>{
        void faile();

        void success(String respons);
    }
}
